﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

namespace Prototype1.__Membership
{
    public partial class WF_ViewProfile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String userQS = Context.Request.QueryString["user"];
            Profile p = null;

            //TESTING
            userQS = "00000000-0000-0000-0000-000000000000";
            if (userQS != null)
            {
                Guid x = new Guid(userQS);


                using (DataAccessDataContext dc = new DataAccessDataContext())
                {
                    var query = from pfile in dc.Profiles
                                where pfile.email.Equals(x)
                                select pfile;
                   
                    p = query.Single<Profile>(); //Não dá para testar para ver se tem?? :X n devolve null
                }

                if (p != null)
                {
                    this.FullName.Text = p.FullName;
                    this.Morada.Text = p.Morada;
                    this.NIB.Text = p.NIB;
                    this.Telefone.Text = "" + p.Telefone;
                    this.Telemovel.Text = "" + p.Telemovel;
                }
            }

        }
    }
}

